import unittest

from FluidClass.FluidSettings import FluidSettings
from ResistanceClass.StraightCircleSmoothWallPipe import StraightCircleSmoothWallPipe as pype
from ResistanceClass.ResistanceAbstractClass import ResistanceAbstractClass as RAC


# Вводим значения длины трубы и диаметра (СИ)
length = 1
diameter = 0.02
superclass = pype(FluidSettings(), length, diameter)

# Вводим значения из Экселя, меняем запятые на точку
Reynolds = 71210.265366
Lambda = 0.01987
PressureDrop = 5047.683663
Velocity = 3.192676893
area = 0.000314159
Total_Resistance = 0.99338

# Точность (оптимально от 2 до 4)
quality = 4


class GeneralParameters(unittest.TestCase):

    def test1_Reynolds(self):
        self.assertEqual(round(superclass.reynolds_number(), quality), round(Reynolds, quality))

    def test2_Lambda(self):
        self.assertEqual(round(superclass.resistance_coefficient_lambda(), quality), round(Lambda, quality))

    def test3_PressureDrop(self):
        self.assertEqual(round(superclass.pressure_drop(), quality), round(PressureDrop, quality))

    def test4_Velocity(self):
        self.assertEqual(round(superclass.velocity(), quality), round(Velocity, quality))

    def test5_Area(self):
        self.assertEqual(round(superclass.area(), quality), round(area, quality))

    def test6_Total_Resistance(self):
        self.assertEqual(round(superclass.total_resistance_coefficient(), quality), round(Total_Resistance, quality))


if __name__ == '__main__':
    unittest.main()
